{% extends 'siteAdmin/index.html' %}

{% block operation %}
    <div id="page">
<div id="box">
        <span class="testa"><h2>Modifica utente</h2></span><br />
            <form  method="POST" action="/siteAdmin/userDetail?USER={{pageData['user'].id}}&amp;done">
        <div class="row thin">
            <span class="word thin">Username ( NON modificabile ):</span>
            <span class="insert thin">
                <input id="username" name="username" type="text" value="{{pageData['user'].username|nonone}}"  tabindex="1" READONLY />
            </span><br /><br />
        </div>

        <div class="row thin">
            <span class="word thin">Email ( NON modificabile ):</span>
            <span class="insert thin">
                <input id="email" name="email" type="text" value="{{pageData['user'].email|nonone}}" tabindex="4" READONLY />
            </span><br /><br />
        </div>
        <div class="row thin">
            <span class="word thin">Ruolo:</span>
            <span class="insert thin">
                <input id="ruolooo" name="ruolooo" type="text" value="{{pageData['user'].role.name|nonone}}" tabindex="55" READONLY />
            </span><br /><br />
        </div>
            <div class="row thin ">
                    <span class="word">Seleziona la lingua predefinita:</span>
                    <select name="languageId">
<!--                     <option value="1">it</option> -->
                    {% for lang in pageData['language'] %}
                    {% if lang.id == pageData["user"].id_language %}
                           <option value="{{lang.id}}" selected="yes">{{lang.denominazione}}</option>
                    {% else %}
                        <option value="{{lang.id}}">{{lang.denominazione}}</option>
                    {% endif %}
                        {% endfor %}
                    </select>
                    </div>

        <div class="row thin bold">
            <span>Dettagli anagrafici e account</span>
        </div>

        <div class="row thin">
            <span class="word thin">Cognome: {{pageData['user'].pegi.cognome|nonone}}</span>
            <span class="insert">
                <input id="cognome" name="cognome" type="text" value="{{pageData['user'].pegi.cognome|nonone}}" tabindex="5" />
            </span><br /><br />
        </div>

        <div class="row thin">
            <span class="word thin">Nome:</span>
            <span class="insert">
                <input id="nome" name="nome" type="text" value="{{pageData['user'].pegi.nome|nonone}}" tabindex="6" />
            </span><br /><br />
        </div>

        <div class="row thin">
            <span class="word thin">Ragione Sociale:</span>
            <span class="insert">
                <input id="ragionesociale" name="ragionesociale" type="text" value="{{pageData['user'].pegi.ragione_sociale|nonone}}" tabindex="7" />
            </span><br /><br />
        </div>

        <div class="row thin">
            <span class="word thin">Insegna:</span>
            <span class="insert">
                <input id="insegna" name="insegna" type="text" value="{{pageData['user'].pegi.insegna|nonone}}" tabindex="8" />
            </span><br /><br />
        </div>

        <div class="row thin">
            <span class="word thin">Codice Fiscale:</span>
            <span class="insert">
                <input id="codicefiscale" name="codicefiscale" type="text" value="{{pageData['user'].pegi.codice_fiscale|nonone}}" tabindex="9" />
            </span><br /><br />
        </div>

        <div class="row thin">
            <span class="word thin">Partita IVA:</span>
            <span class="insert">
                <input id="partitaiva" name="partitaiva" type="text" value="{{pageData['user'].pegi.partita_iva|nonone}}" tabindex="10" />
            </span><br /><br />
        </div>

        <div class="row thin">
            <span class="word thin">Telefono:</span>
            <span class="insert">
                <input id="telefono" name="telefono" type="text" value="{{pageData['cl'].telefono|nonone}}" tabindex="11" />
            </span><br /><br />
        </div>

        <div class="row thin">
            <span class="word thin">Fax:</span>
            <span class="insert">
                <input id="fax" name="fax" type="text" value="{{pageData['cl'].fax|nonone}}" tabindex="12" />
            </span><br /><br />
        </div>

        <div class="textarea">
            <span class="word thin">Note:</span>
<!--            <span class="insert">-->
            <textarea name="note" rows="6" cols="50"  tabindex="13">{{pageData['cl'].note|nonone}}</textarea>
<!--            </span>-->
            <br /><br />
        </div>

        <div class="row thin lineTop bold">
            <span>Sede legale</span>
        </div>

        <div class="row thin">
            <span class="word thin">Indirizzo:</span>
            <span class="insert">
                <input id="sede_legale_indirizzo" name="sede_legale_indirizzo" type="text" value="{{pageData['user'].pegi.sede_legale_indirizzo|nonone}}" tabindex="14" />
            </span><br /><br />
        </div>


        <div class="row thin">
            <span class="word thin">Località:</span>
            <span class="insert">
                <input id="sede_legale_localita" name="sede_legale_localita" type="text" value="{{pageData['user'].pegi.sede_legale_localita|nonone}}" tabindex="15" />
            </span><br /><br />
        </div>

        <div class="row thin">
            <span class="word thin">CAP:</span>
            <span class="insert">
                <input id="sede_legale_cap" name="sede_legale_cap" type="text" value="{{pageData['user'].pegi.sede_legale_cap|nonone}}" tabindex="16" />
            </span><br /><br />
        </div>

        <div class="row thin">
            <span class="word thin">Provincia:</span>
                <select name="sedelegaleprovincia">
                {% for prov in pageData['province'] %}
                    {% if prov.id == pageData["user"].pegi.id_sede_legale_provincia %}
                           <option value="{{prov.id}}" selected="yes">{{prov.denominazione}}&nbsp;(&nbsp;{{prov.denominazione_breve}}</option>
                    {% else %}
                    <option value="{{prov.id }}">{{prov.denominazione}}&nbsp;(&nbsp;{{prov.denominazione_breve }}&nbsp;) </option>
                    {% endif %}
                {% endfor %}
                </select>
            </span><br /><br />
        </div>


        <div class="row thin">
            <span class="word thin">Regione:</span>
                <select name="sedelegaleregione">
                {% for reg in pageData['regioni'] %}
                    {% if reg.id == pageData["user"].pegi.id_sede_legale_regione %}
                           <option value="{{reg.id}}" selected="yes">{{reg.denominazione}}</option>
                    {% else %}
                    <option value="{{reg.id }}">{{reg.denominazione}}</option>
                    {% endif %}
                {% endfor %}
                </select>
            </span><br /><br />
        </div>

        <div class="row thin">
            <span class="word thin">Nazione:</span>
                <select name="sedelegalenazione">{{naz}}
                {% for naz in pageData['nazioni'] %}
                    {% if naz|string == pageData["user"].pegi.nazione %}
                           <option value="{{nazstring}}" selected="yes">{{naz|string}}</option>
                    {% else %}
                    <option value="{{naz|string}}">{{naz|string}}</option>
                    {% endif %}
                {% endfor %}
                </select>
            </span><br /><br />
        </div>
                    <div class="row thin">
                <input type="submit" value="Aggiungi/Modifica"  tabindex="8" />
                <input type="reset" value="Annulla" />
            </div><br/ >
            {% if "tipo" in pageData or "tipo" in pageData["forms"] %}
            <input type="submit" name="Step_finale" value="Step_finale"  tabindex="8" />
            {%endif%}
                </form>
    </div>    </div>
{% endblock %}
